<template>
  <a-modal title="审核" :visible="visible" @ok="onSubmit" @cancel="onCancel">
    <a-form-model
      ref="ruleForm"
      :model="form"
      :label-col="{ span: 6 }"
      :wrapper-col="{ span: 14 }"
    >
      <a-form-model-item ref="state" label="审核结果">
        <a-radio-group v-model="form.state">
          <!-- <a-radio value="pending"> 待审核 </a-radio> -->
          <a-radio value="pass"> 通过 </a-radio>
          <a-radio value="reject"> 拒绝 </a-radio>
        </a-radio-group>
      </a-form-model-item>
    </a-form-model>
  </a-modal>
</template>
<script>
// import { mapGetters } from 'vuex'

export default {
  data() {
    return {
      visible: false,
      row: null,
      form: {
        state: 'pending',
      },
    }
  },
  computed: {
    // ...mapGetters('account', ['sys']),
  },
  methods: {
    show(row) {
      this.row = { ...row }
      this.form = row
      this.visible = true
    },
    onSubmit() {
      this.axios
        .put(`/a/sells/${this.form.id}/review`, { state: this.form.state })
        .then((res) => {
          this.visible = false
          this.$store.dispatch('account/noticeCount')
          this.$message.success('审核成功')
          //   this.$emit('refresh')
        })
    },
    onCancel() {
      Object.assign(this.form, this.row)
      this.visible = false
    },
  },
}
</script>
